package com.haizhi.crm.search.builder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by chengmo on 2018/5/31.
 */
public class RangeBuilder {

    private List<Map<String, Object>> ranges = new ArrayList<>();

    public List<Map<String, Object>> ranges() {
        return ranges;
    }

    /**
     * Adds a range.
     *
     * @param from
     * @param to
     * @return
     */
    public RangeBuilder addRange(Object from, Object to) {
        Map<String, Object> range = new HashMap<>();
        range.put(SKeys.FROM_FIELD, from);
        range.put(SKeys.TO_FIELD, to);
        ranges.add(range);
        return this;
    }
}
